<?php

namespace App\Console\Commands\Feishu;

use App\Models\Common\FsCompanyModel;
use App\Models\Common\FsCompanySecondDepartmentModel;
use App\Models\Common\FsCompanyUserMappingModel;
use App\Models\Cruise\CruiseCheckCompanyModel;
use Illuminate\Console\Command;

class DelFsCompanyCommand extends Command
{
    protected $signature   = 'feishu:del-company {fsCompanyId}';
    protected $description = '删除飞书供应商';

    public function handle()
    {
        $fsCompanyId = $this->argument('fsCompanyId');

        FsCompanyModel::query()->where('id', $fsCompanyId)->update(['isDeleted' => 1]);
        FsCompanySecondDepartmentModel::query()->where('fsCompanyId', $fsCompanyId)->update(['isDeleted' => 1]);
        FsCompanyUserMappingModel::query()->where('fsCompanyId', $fsCompanyId)->update(['isDeleted' => 1]);
        CruiseCheckCompanyModel::query()->where('fsCompanyId', $fsCompanyId)->update(['isDeleted' => 1]);
    }
}
